import { pecReadStitches } from "./EmbroideryPes";
import { Pattern } from "./EmbroideryPattern";
import { pecColors, Color } from "./EmbroideryColor";

export function pecRead(file) {
    let colorChanges, i;
    const pattern = new Pattern();
    file.seek(0x38);
    colorChanges = file.getUint8();
    for (i = 0; i <= colorChanges; i++) {
        pattern.addColor(pecColors[file.getUint8() % 65]);
    }
    file.seek(0x21c);
    pecReadStitches(file, pattern);
    return pattern;
}
